<template>
  <el-dialog :title="isEdit?'编辑':'新增'" :visible.sync="isShow" append-to-body width="600px" @close="closeDialog">
    <el-form
      ref="form"
      :rules="rules"
      :model="formData"
      label-position="center"
      size="large"
      label-width="120px"
    >
      <el-form-item label="样本名称" prop="name">
        <el-input v-model="formData.name" placeholder="请输入" style="width:200px;" />
      </el-form-item>
      <el-form-item label="信息1" prop="name">
        <el-input v-model="formData.name" placeholder="请输入" style="width:200px;" />
      </el-form-item>
      <el-form-item label="信息2" prop="name">
        <el-input v-model="formData.name" placeholder="请输入" style="width:200px;" />
      </el-form-item>
      <el-form-item label="信息3" prop="name">
        <el-input v-model="formData.name" placeholder="请输入" style="width:200px;" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="closeDialog">取消</el-button>
      <el-button type="primary" :loading="loading" @click="confirmSubmit">确定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'AddNewProcess',
  data() {
    return {
      isShow: false,
      isEdit: false,
      rules: [],
      formData: {
        name: ''
      },
      loading: false
    }
  },
  methods: {
    init(isEdit = false, data) {
      this.isEdit = isEdit
      if (this.isEdit) {
        this.formData.name = data.name
      }
      this.isShow = true
    },
    closeDialog() {
      this.isShow = false
    },
    confirmSubmit() {
      this.closeDialog()
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
